import request from "@/utils/request"

export interface QueryBigClientListParams extends PaginationParams {
  /** 名称 */
  companyName?: string
  /** 登录账号 */
  loginPhone?: string
  /** 身份证/组织机构代码 */
  orgCode?: string
}

export enum BigClientOrgType {
  身份证 = 0,
  组织机构代码 = 1,
}

export enum BigClientStatus {
  启用 = 1,
  禁用 = 0,
}

export interface BigClient {
  agent: string
  /** 余额 */
  amount: number
  area: string
  businessLicense: string
  /** 负责人姓名 */
  chiefName: string
  /** 负责人手机号 */
  chiefPhone: string
  /** 省市区 */
  cityName: string
  /** 详细地址 */
  companyAddress: string
  companyId: string
  companyName: string
  companyPhone: string
  companyType: number
  createTime: number
  credit: number
  email: string
  id: string
  infoId: number
  isVinCheck: number
  lastLoginTime: number
  /** 登录账号 */
  loginPhone: string
  logo: string
  menus: []
  /** 证件号码 */
  orgCode: string
  orgType: BigClientOrgType
  password: string
  product: string
  status: BigClientStatus
  stubGroupIds: string
  /** 选择的城市ID */
  subsidiaryId: string
  updateTime: number
  verifyStatus: number
}

export async function queryChargeList(params: QueryBigClientListParams) {
  return request<BigClient[]>('/app/manager/bigCompany/list', {
    data: params,
  })
}

export async function updateStatus(params: {id: string, status: BigClientStatus}) {
  return request('/app/manager/bigCompany/status', {
    data: params,
  })
}

export async function getBigClientDetail(params: {id: string}) {
  return request<BigClient>('/app/manager/bigCompany/detail', {
    data: params,
  })
}

export async function editBigClient(params: Partial<BigClient>) {
  return request('/app/manager/bigCompany/addOrUp', {
    data: params,
  })
}

export async function resetPsw(params: {id: string}) {
  return request('/app/manager/bigCompany/resetPass', {
    data: params,
  })
}

export interface ChargeMoneyParams {
  id: string
  amount: number
  commend?: string
}
export async function chargeMoney(params: {id: string}) {
  return request('/app/manager/bigCompany/recharge', {
    data: params,
  })
}
